package com.ftg.learn.controller;

import com.ftg.learn.common.dto.LoginDto;
import com.ftg.learn.common.util.R;
import com.ftg.learn.service.AuthService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 布衣
 */
@RestController
@Tag(name = "鉴权")
@RequestMapping("/authCenter")
public class AuthCenterController {

    @Autowired
    AuthService authService;

    /**
     * 查询所有用户
     *
     * @return
     */
    @Operation(summary = "登陆并令牌")
    @PostMapping("/auth")
    public R<String> loginAndToken(
            @RequestBody LoginDto login
    ) {
        return authService.loginAndToken(login);
    }

}
